#
# OAISData.py
#
# <http://www.ccsds.org/>
# <http://public.ccsds.org/publications/archive/650x0b1.pdf>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright 2009 Jeremy Nelson, Tomichi Informatics
#
import datetime,os

from basedata import *
from google.appengine.ext import db
from google.appengine.api import users

#=============================================================================#
# OAIS Models                                                                 #
#=============================================================================#
class InformationObject(BaseModel):
    ''' A combination of data and Representation Information.'''
    type_of = db.StringProperty(required=False,
                                choices=(["digital",
                                          "physical"]))

class ContentInformation(InformationObject):
    ''' Set of information that is the original target of preservation.'''
    content_data_object = db.ReferenceProperty()
    representation_info = db.ListProperty(db.Key,
                                          default=None)

    def get_representation_info(self):
        return self.get_collection(property_name="representation_info")

class PreservationDescriptionInformation(InformationObject):
    ''' Includes information that will allow the understanding of the
        Content Information over an indefinite period of time. pg.4/27 '''
    context_info = db.ListProperty(db.Key,
                                  default=None)
    fixity_info = db.ListProperty(db.Key,
                                  default=None)
    provenance_info = db.ListProperty(db.Key,
                                      default=None)
    reference_info = db.ListProperty(db.Key,
                                     default=None)


    def get_context(self):
        return self.get_collection(property_name="context_info")

    def get_fixity(self):
        return self.get_collection(property_name="fixity_info")

    def get_provenance(self):
        return self.get_collection(property_name="provenance_info")

    def get_references(self):
        return self.get_collection(property_name="reference_info")


    
